package com.alibaba.sentinel.service;


import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class SentinelService {

    //    @SentinelResource  // 定义标识资源限流降级属性，value属性表示资源名
    public String getTestA() {
        try {
            TimeUnit.MILLISECONDS.sleep(800);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("--- test a");
        return "----test a";
    }

    //    @SentinelResource
    public String getTestB() {
        System.out.println("--- test b");
        try {
            Thread.sleep(2000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "----test B";
    }

    public String getTestC() {
        System.out.println(9 / 0);
        return "----test C";
    }
}
